common: env_flags: fix loop condition when using env_flags_varaccess_mask
authorPeng Fan <[email protected]>
Tue, 12 Jan 2016 09:23:12 +0000 (17:23 +0800)
committerTom Rini <[email protected]>
Thu, 14 Jan 2016 02:05:26 +0000 (21:05 -0500)
commitdb18f548cb7b5ff99223b66eac1966eb45230817
tree4b1088d7ea6775ffb31b359463f1a9423710a8ad
parentbb08a6e7d513cc1f591b35a6e7e68dd92078eed6
common: env_flags: fix loop condition when using env_flags_varaccess_mask

We should use ARRAY_SIZE, but not sizeof. The size of
env_flags_varaccess_mask is 16bytes, but we only need 4 loops.
If using 16 as the end condition, we may access memory that
not belong to array env_flags_varaccess_mask.

Signed-off-by: Peng Fan <[email protected]>
Cc: Joe Hershberger <[email protected]>
Cc: York Sun <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Acked-by: Joe Hershberger <[email protected]>
common/env_flags.c